package v1

import (
	"itam/internal/model"

	"github.com/gogf/gf/v2/frame/g"
)

// create
type MiddlewareCreateReq struct {
	g.Meta    `path:"/middleware" tags:"中间件" method:"post" summary:"新增中间件"`
	Name      string `v:"required" json:"name"      description:"中间件名称"`
	IpAddress string `v:"required" json:"ipAddress" description:"ip地址"`
	Port      int    `v:"required" json:"port"      description:"端口号"`
	EnvId     int    `v:"required" json:"envId"     description:"环境id"`
}
type MiddlewareCreateRes struct {
	Id int
}

// update
type MiddlewareUpdateReq struct {
	g.Meta    `path:"/middleware" tags:"中间件" method:"put" summary:"修改中间件"`
	Id        int    `json:"id"        description:""`
	IpAddress string `json:"ipAddress" description:"ip地址"`
	Port      int    `json:"port"      description:"端口号"`
	EnvId     int    `json:"envId"     description:"环境id"`
}
type MiddlewareUpdateRes struct{}

// delete
type MiddlewareDeleteReq struct {
	g.Meta `path:"/middleware/{Id}" tags:"中间件" method:"delete" summary:"删除中间件"`
	Id     int `in:"path" json:"id" v:"min:1#请选择需要删除的中间件" dc:"环境id"`
}
type MiddlewareDeleteRes struct{}

// getlist
type MiddlewareGetListReq struct {
	g.Meta    `path:"/middleware" tags:"中间件" method:"get" summary:"中间件列表"`
	Name      string `json:"name"      description:"中间件名称"`
	IpAddress string `json:"ipAddress" description:"ip地址"`
	Port      int    `json:"port"      description:"端口号"`
	EnvId     int    `json:"envId"     description:"环境id"`
	Page      int    `json:"page" in:"query" d:"1"  v:"min:0#分页号码错误"     dc:"分页号码，默认1"`
	Size      int    `json:"size" in:"query" d:"10" v:"max:50#分页数量最大50条" dc:"分页数量，最大50"`
}

type MiddlewareGetListRes struct {
	MiddlewareList []model.MiddlewareListItem `json:"list" description:"中间件列表"`
	Page           int                        `json:"page" description:"分页码"`
	Size           int                        `json:"size" description:"分页数量"`
	Total          int                        `json:"total" description:"数据总数"`
}

//type MiddlewareGetListOutputItem struct {
//	Middleware *MiddlewareListItem    `json:"middleware"`
//	Env        *MiddlewareListEnvItem `json:"env"`
//}
//
//type MiddlewareListItem struct {
//	Id        int    `json:"id"        description:""`
//	Name      string `json:"name"      description:"中间件名称"`
//	IpAddress string `json:"ipAddress" description:"ip地址"`
//	Port      int    `json:"port"      description:"端口号"`
//	EnvId     int    `json:"envId"     description:"环境id"`
//}
//
//type MiddlewareListEnvItem struct {
//	Id   int    `json:"id"   description:""`
//	Name string `json:"name" description:"环境名称"`
//}
